package com.xxxy.ljh.myapplication.model;

import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

/**
 * 社团数据模型
 */
public class Club implements Serializable {
    private int id;
    private String name;
    private String description;
    private int founderId;
    private String founderName;
    private String founder;
    private int memberCount;
    private String createTime;
    // 添加社团审核相关字段
    private String category;
    private String logo;
    private String contact_phone;
    private String contact_email;
    private int audit_status;
    private String audit_time;
    private int audit_admin_id;
    private String audit_remark;
    private String update_time;
    private int status;

    public Club() {
    }

    public Club(int id, String name, String description, String founder, int founderId, int memberCount, String createTime) {
        this.id = id;
        this.name = name;
        this.description = description;
        this.founder = founder;
        this.founderId = founderId;
        this.memberCount = memberCount;
        this.createTime = createTime;
    }
    
    public void incrementMemberCount() {
        this.memberCount++;
    }

    public void decrementMemberCount() {
        if (this.memberCount > 0) {
            this.memberCount--;
        }
    }

    // Getters and Setters
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getFounder() {
        return founder;
    }

    public void setFounder(String founder) {
        this.founder = founder;
    }

    public int getFounderId() {
        return founderId;
    }

    public void setFounderId(int founderId) {
        this.founderId = founderId;
    }

    public int getMemberCount() {
        return memberCount;
    }

    public void setMemberCount(int memberCount) {
        this.memberCount = memberCount;
    }

    public String getCreateTime() {
        return createTime;
    }

    public String getFounderName() {
        return founderName;
    }

    public void setFounderName(String founderName) {
        this.founderName = founderName;
    }
    
    public String getFormattedCreateTime() {
        if (createTime != null && !createTime.isEmpty()) {
            try {
                // 如果是时间戳格式
                long timestamp = Long.parseLong(createTime);
                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault());
                return sdf.format(new Date(timestamp * 1000));
            } catch (NumberFormatException e) {
                // 如果已经是格式化后的时间字符串
                return createTime;
            }
        }
        return "未知时间";
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }
    
    // 新增的getter和setter方法
    public String getCategory() {
        return category;
    }

    public void setCategory(String category) {
        this.category = category;
    }

    public String getLogo() {
        return logo;
    }

    public void setLogo(String logo) {
        this.logo = logo;
    }

    public String getContact_phone() {
        return contact_phone;
    }

    public void setContact_phone(String contact_phone) {
        this.contact_phone = contact_phone;
    }

    public String getContact_email() {
        return contact_email;
    }

    public void setContact_email(String contact_email) {
        this.contact_email = contact_email;
    }

    public int getAudit_status() {
        return audit_status;
    }

    public void setAudit_status(int audit_status) {
        this.audit_status = audit_status;
    }

    public String getAudit_time() {
        return audit_time;
    }

    public void setAudit_time(String audit_time) {
        this.audit_time = audit_time;
    }

    public int getAudit_admin_id() {
        return audit_admin_id;
    }

    public void setAudit_admin_id(int audit_admin_id) {
        this.audit_admin_id = audit_admin_id;
    }

    public String getAudit_remark() {
        return audit_remark;
    }

    public void setAudit_remark(String audit_remark) {
        this.audit_remark = audit_remark;
    }

    public String getUpdate_time() {
        return update_time;
    }

    public void setUpdate_time(String update_time) {
        this.update_time = update_time;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }
    
    // 为保持兼容性，提供别名方法
    public String getAssociation_name() {
        return name;
    }
    
    public void setAssociation_name(String association_name) {
        this.name = association_name;
    }
    
    // 添加缺失的方法
    public String getCreate_time() {
        return createTime;
    }
    
    public void setCreate_time(String create_time) {
        this.createTime = create_time;
    }
}